import java.util.ArrayList;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86131
 * Date: 2024-01-18
 * Time: 21:08
 */
public class ArrayListDemo1 {
    public static void main(String[] args) {
        //1.创建集合的对象
        //泛型:限定集合中存储数据的类型
        ArrayList<String> list = new ArrayList<>();
        list.add("111");
        list.add("222");
        list.add("333");
        list.add("444");
        System.out.print("[");
        for (int i = 0;i<list.size();i++){
            if(i == list.size() -1){
                System.out.print(list.get(i));
            }else{
                System.out.print(list.get(i)+",");
            }
        }
        System.out.println("]");
    }
}
